package cn.wxq.daily.empdailymgforserve.controller;

import cn.wxq.daily.empdailymgforserve.domain.SysDept;
import cn.wxq.daily.empdailymgforserve.model.Result;
import cn.wxq.daily.empdailymgforserve.model.StatusCode;
import cn.wxq.daily.empdailymgforserve.service.SysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@CrossOrigin //跨越处理
@RestController
@RequestMapping("/system/dept")
@Api(value = "sysDeptController|部门管理控制器")
public class sysDeptController {
    @Autowired
    private SysDeptService sysDeptService;
    /**
     * 获取角色信息
     *
     * @return
     */
    @RequestMapping(value = "/findAllDept", method = RequestMethod.POST)
    @ApiOperation(value = "获取岗位信息")
    public Result findAllDept() {
        List<SysDept> sysDepts = sysDeptService.selectDeptAll();
        if (sysDepts !=null){
            return new Result(true, StatusCode.OK, "获取角色成功", sysDepts);
        }else {
            return new Result(false, StatusCode.ERROR, "获取角色失败");
        }

    }
}
